package com.itlong.cloud.operate.dao;

import com.itlong.cloud.POJO.VO.operate.OperateAddressVO;
import com.itlong.cloud.POJO.VO.operate.OperateAreaAddressVO;
import com.itlong.cloud.POJO.VO.operate.OperateCountryAddressVO;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <desc>
 *     运营-运营管理-项目地址操作数据接口。
 * <desc/>
 *
 * @createDate 2017/10/23.
 */
@Mapper
@Repository
public interface IOperateAddressManageDao {

    /**
     * <desc>
     *      获取国家列表。
     * <desc/>
     *
     * @param
     * @return
     * @author shengen.T
     * @createDate 2017/10/23
     */
    List<OperateCountryAddressVO> getCountry();

    /**
     * <desc>
     *      获取区列表信息。
     * <desc/>
     *
     * @param  countryId 国家ID
     * @return
     * @author shengen.T
     * @createDate 2017/10/23
     */
    List<OperateAreaAddressVO> getArea(String countryId);

    /**
     * <desc>
     *      获取某个地址的直接下属地址
     * <desc/>
     *
     * @param parentAddressId 父地址id
     * @return
     * @author Chunjian.G
     * @createDate 2017-12-05
     */
    List<OperateAddressVO> getAddressList(@Param("parentAddressId")String parentAddressId);

    /**
     * <desc>
     *      批量获取多个地址的直接下属地址个数
     * <desc/>
     *
     * @param parentAddressIds 父地址id集合
     * @return
     * @author Chunjian.G
     * @createDate 2017-12-05
     */
    List<SubAddressCount> getSubAddressCount(@Param("parentAddressIds") String[] parentAddressIds);


    /**
     * 批量统计下属地址个数
     */
    @Data
    @NoArgsConstructor
    public static class SubAddressCount{
        private String parentAddressId;
        private int count;
    }
}
